<?php
/**
 * User: hjd-yao
 * Date: 2019/4/16
 * Time: 13:24
 */
Route::prefix('rule')->group(function (){
    Route::get('/')->uses('ShopRuleController@rules')->name('b_ShopRule_rules');
    Route::post('edit')->uses('ShopRuleController@update')->name('b_ShopRule_update');
});

Route::prefix('category')->group(function (){
    Route::get('list')->uses('ShopCategoryController@categories')->name('b_ShopCategory_categories');

    Route::match(['get','post'],'add')->uses('ShopCategoryController@create')->name('b_ShopCategory_create');

    Route::match(['get','post'],'edit/{id}')->uses('ShopCategoryController@update')->name('b_ShopCategory_update')
        ->where('id','[0-9]+');

    Route::get('remove/{id}')->uses('ShopCategoryController@delete')->name('b_ShopCategory_delete')
        ->where('id','[0-9]+');

    Route::get('switch/{id}')->uses('ShopCategoryController@switchCategory')->name('b_ShopCategory_switchCategory')
        ->where('id','[0-9]+');
});

Route::prefix('type')->group(function (){
    Route::get('/')->uses('ShopTypeController@types')->name('b_ShopType_types');

    Route::match(['post','get'],'add')->uses('ShopTypeController@create')->name('b_ShopType_create');

    Route::match(['post','get'],'edit/{id}')->uses('ShopTypeController@update')->name('b_ShopType_update')
        ->where('id','[0-9]+');

    Route::get('remove/{id}')->uses('ShopTypeController@delete')->name('b_ShopType_delete')
        ->where('id','[0-9]+');

    Route::post('batch-remove')->uses('ShopTypeController@batchDelete')->name('b_ShopType_batchDelete');

});

Route::prefix('attribute')->group(function (){
    Route::get('attr-by-type')->uses('GoodsAttributeController@getAttributeByTypeId')->name('b_GoodsAttribute_getAttributeByTypeId');
});

Route::prefix('spec')->group(function (){
    Route::get('/')->uses('ShopSpecController@specs')->name('b_ShopSpec_specs');

    Route::match(['post','get'],'add')->uses('ShopSpecController@create')->name('b_ShopSpec_create');

    Route::match(['post','get'],'edit/{id}')->uses('ShopSpecController@update')->name('b_ShopSpec_update')
        ->where('id','[0-9]+');

    Route::get('remove/{id}')->uses('ShopSpecController@delete')->name('b_ShopSpec_delete')
        ->where('id','[0-9]+');

    Route::post('batch-remove')->uses('ShopSpecController@batchDelete')->name('b_ShopSpec_batchDelete');

    Route::get('specs-by-type')->uses('ShopSpecController@getSpecByTypeId')->name('b_ShopSpec_getSpecByTypeId');

    Route::match(['get','post'],'sku/{goods_id}')->uses('ShopSpecController@getSKUByGoodsId')->name('b_ShopSpec_getSKUByGoodsId')
        ->where('goods_id','[0-9]+');

});

Route::prefix('brand')->group(function (){
    Route::get('/')->uses('ShopBrandController@brands')->name('b_ShopBrand_brands');

    Route::match(['get','post'],'add')->uses('ShopBrandController@create')->name('b_ShopBrand_create');

    Route::match(['get','post'],'edit/{id}')->uses('ShopBrandController@update')->name('b_ShopBrand_update')
        ->where('id','[0-9]+');

    Route::get('remove/{id}')->uses('ShopBrandController@delete')->name('b_ShopBrand_delete')
        ->where('id','[0-9]+');

    Route::post('batch-remove')->uses('ShopBrandController@batchDelete')->name('b_ShopBrand_batchDelete');

    Route::get('switch/{id}')->uses('ShopBrandController@state')->name('b_ShopBrand_state')
        ->where('id','[0-9]+');
});

Route::prefix('goods')->group(function (){

    Route::get('/{zone?}')->uses('ShopGoodsController@goods')->name('b_ShopGoods_goods')
        ->where(['zone'=>'1|2|3|4']);

    Route::get('off-goods')->uses('ShopGoodsController@offShelfGoods')->name('b_ShopGoods_offShelfGoods');

    Route::get('info/{id}')->uses('ShopGoodsController@infoGoods')->name('b_ShopGoods_infoGoods')
        ->where(['id'=>'[0-9]+']);

    Route::match(['get','post'],'add/{zone?}')->uses('ShopGoodsController@create')->name('b_ShopGoods_create')
        ->where(['zone'=>'1|2|3|4']);

    Route::match(['get','post'],'edit/{id}')->uses('ShopGoodsController@update')->name('b_ShopGoods_update')
        ->where(['id'=>'[0-9]+']);

    Route::match(['get','post'],'edit-price/{id}')->uses('ShopGoodsController@updatePrice')->name('b_ShopGoods_updatePrice')
        ->where(['id'=>'[0-9]+']);

    Route::get('remove/{id}')->uses('ShopGoodsController@delete')->name('b_ShopGoods_delete')
        ->where(['id'=>'[0-9]+']);

    Route::post('batch-remove')->uses('ShopGoodsController@batchDelete')->name('b_ShopGoods_batchDelete');

    Route::get('label-switch/{id}/{label}')->uses('ShopGoodsController@switchLabelState')->name('b_ShopGoods_switchLabelState')
        ->where(['id'=>'[0-9]+','label'=>'hot|new|recommend|home_show']);

    Route::get('switch/{id}')->uses('ShopGoodsController@upOrDown')->name('b_ShopGoods_upOrDown')
        ->where(['id'=>'[0-9]+']);

    Route::get('down/{id}')->uses('ShopGoodsController@foreverDown')->name('b_ShopGoods_foreverDown')
        ->where(['id'=>'[0-9]+']);

});

Route::prefix('order')->group(function (){
    Route::get('/')->uses('ShopOrderController@orderList')->name('b_ShopOrder_orderList');
    Route::get('no-pay')->uses('ShopOrderController@waitPayOrder')->name('b_ShopOrder_waitPayOrder');
    Route::get('no-send')->uses('ShopOrderController@waitSendOrder')->name('b_ShopOrder_waitSendOrder');
    Route::get('no-confirm')->uses('ShopOrderController@waitConfirmOrder')->name('b_ShopOrder_waitConfirmOrder');
    Route::get('complete')->uses('ShopOrderController@completeOrder')->name('b_ShopOrder_completeOrder');

    Route::get('detail/{order_id}')->uses('ShopOrderController@detail')->name('b_ShopOrder_detail')
        ->where('order_id','[0-9]+');

    Route::match(['post','get'],'modify-post/{order_id}')->uses('ShopOrderController@editPostInfo')->name('b_ShopOrder_editPostInfo')
        ->where('order_id','[0-9]+');

    Route::match(['post','get'],'modify-pay/{order_id}')->uses('ShopOrderController@editPayMoney')->name('b_ShopOrder_editPayMoney')
        ->where('order_id','[0-9]+');

    Route::match(['post','get'],'deliver-goods/{order_id}')->uses('ShopOrderController@deliverGoods')->name('b_ShopOrder_deliverGoods')
        ->where('order_id','[0-9]+');

    Route::get('print/{order_id}')->uses('ShopOrderController@printOrder')->name('b_ShopOrder_printOrder')
        ->where('order_id','[0-9]+');

    Route::match(['post','get'],'close')->uses('ShopOrderController@close')->name('b_ShopOrder_close');

    Route::match(['post','get'],'remove')->uses('ShopOrderController@delete')->name('b_ShopOrder_delete');

    Route::get('export')->uses('ShopOrderController@exportOrder')->name('b_ShopOrder_exportOrder');

    /*退货订单*/
    Route::get('return-bill')->uses('ReturnGoodsController@returnList')->name('b_ReturnGoods_returnList');
});

Route::prefix('ad')->group(function (){
    Route::get('slide')->uses('ShopAdController@slideAd')->name('b_ShopAd_slideAd');

    Route::match(['post','get'],'add-slide')->uses('ShopAdController@createSlide')->name('b_ShopAd_createSlide');

    Route::match(['post','get'],'edit-slide/{ad_id}')->uses('ShopAdController@updateSlide')->name('b_ShopAd_updateSlide')
        ->where('ad_id','[0-9]+');

    Route::match(['post','get'],'remove-slide')->uses('ShopAdController@deleteSlide')->name('b_ShopAd_deleteSlide');


    Route::get('/')->uses('ShopAdController@index')->name('b_ShopAd_index');

    Route::get('position')->uses('ShopAdController@adPos')->name('b_ShopAd_adPos');

    Route::match(['post','get'],'add/{pos_id}')->uses('ShopAdController@create')->name('b_ShopAd_create')
        ->where('pos_id','[0-9]+');

    Route::match(['post','get'],'edit/{ad_id}')->uses('ShopAdController@update')->name('b_ShopAd_update')
        ->where('ad_id','[0-9]+');

    Route::match(['post','get'],'switch/{id}')->uses('ShopAdController@switchAd')->name('b_ShopAd_switchAd')
        ->where('id','[0-9]+');

    Route::match(['post','get'],'remove')->uses('ShopAdController@delete')->name('b_ShopAd_delete');

    Route::get('clear')->uses('ShopAdController@clearAdPos')->name('b_ShopAd_clearAdPos');

});